﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Formsy.Data.Services;
using Formsy.Data.Linq;

namespace Formsy.Test
{
    [TestClass]
    public class UnitTest1
    {
        string m_FormName = "UnitTest";

        /* 
        // TESTS
        // insert and update
        IFormsyEntry InsertEntry(string formName);
        List<IFormsyEntryData> InsertEntryData(int entryId, Dictionary<string, string> dictionary);
        List<IFormsyEntryData> UpdateEntryData(int entryId, Dictionary<string, string> dictionary);


        // helper methods
        int GetFormId(string formName);
        IFormsyForm GetForm(string formName);
        void EnsureFormExists(string formName);
        IFormsyForm CreateForm(string formName);


        // csv methods
        DataTable GetCSV(string competitionName, DateTime start, DateTime end, string path, List<string> ignoreList);
        List<IFormsyEntry> GetEntries(string formName, DateTime start, DateTime end);
        DataTable GetHeadings(List<IFormsyEntry> entries, List<string> nonDataHeadings, DataTable table, List<string> ignoreList);
        */


        [TestMethod]
        public void InsertEntry()
        {
            var entry = HttpDataService.Instance.FormsyService.InsertEntry(m_FormName);
            Assert.IsInstanceOfType(entry, typeof(FormsyEntry));

            var form = HttpDataService.Instance.FormsyService.GetForm(m_FormName);
            Assert.IsInstanceOfType(form, typeof(FormsyForm));
        }


    }
}
